#include "UiCallRecWnd.h"
#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiCallRecWnd::UiCallRecWnd()
{
}

UiCallRecWnd::~UiCallRecWnd()
{
}

BOOL UiCallRecWnd::InitUiWin(void)
{
	BOOL bRtn = FALSE;
	LoadiInterItem();
	return bRtn;
}

void UiCallRecWnd::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
//	m_CallRecWndBG->Draw(hdc, prcWin, false, false);
}

int UiCallRecWnd::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiCallRecWnd::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);

}

void UiCallRecWnd::LoadiInterItem()
{
//jdhuang 20120818
	
#ifndef MERGER_APP_TO_SHELL
	m_CallRecWndBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1065);
#else
	m_CallRecWndBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 5065);
#endif
	RECT rtBtnCallRecWnd[] = 
	{
		140, 10, 211, 77,
		270, 10, 341, 77,
		400, 10, 471, 77,
		530, 10, 601, 77,
	};
	
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetPos(rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].left, rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].top,
					rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].right-rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].left,
					rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].bottom-rtBtnCallRecWnd[CALL_REC_WND_CALL_OUT].top);
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetID(2100);
#ifndef MERGER_APP_TO_SHELL
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1052, true));
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1053, true));
#else
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5052, true));
	m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5053, true));
#endif
	AddChild(&m_BtnCallRecWnd[CALL_REC_WND_CALL_OUT]);

	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetPos(rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].left, rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].top,
					rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].right-rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].left,
					rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].bottom-rtBtnCallRecWnd[CALL_REC_WND_CALL_IN].top);
	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetID(2101);
#ifndef MERGER_APP_TO_SHELL
	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1054, true));
	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1055, true));
#else
	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5054, true));
	m_BtnCallRecWnd[CALL_REC_WND_CALL_IN].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5055, true));
#endif
	AddChild(&m_BtnCallRecWnd[CALL_REC_WND_CALL_IN]);

	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetPos(rtBtnCallRecWnd[CALL_REC_WND_MISSED].left, rtBtnCallRecWnd[CALL_REC_WND_MISSED].top,
					rtBtnCallRecWnd[CALL_REC_WND_MISSED].right-rtBtnCallRecWnd[CALL_REC_WND_MISSED].left,
					rtBtnCallRecWnd[CALL_REC_WND_MISSED].bottom-rtBtnCallRecWnd[CALL_REC_WND_MISSED].top);
	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetID(2102);
#ifndef MERGER_APP_TO_SHELL
	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1056, true));
	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1057, true));
#else
	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5056, true));
	m_BtnCallRecWnd[CALL_REC_WND_MISSED].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5057, true));
#endif
	AddChild(&m_BtnCallRecWnd[CALL_REC_WND_MISSED]);

	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetPos(rtBtnCallRecWnd[CALL_REC_WND_DELETE].left, rtBtnCallRecWnd[CALL_REC_WND_DELETE].top,
					rtBtnCallRecWnd[CALL_REC_WND_DELETE].right-rtBtnCallRecWnd[CALL_REC_WND_DELETE].left,
					rtBtnCallRecWnd[CALL_REC_WND_DELETE].bottom-rtBtnCallRecWnd[CALL_REC_WND_DELETE].top);
	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetID(2103);
#ifndef MERGER_APP_TO_SHELL
	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1050, true));
	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1051, true));
#else
	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5050, true));
	m_BtnCallRecWnd[CALL_REC_WND_DELETE].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,5051, true));
#endif
	AddChild(&m_BtnCallRecWnd[CALL_REC_WND_DELETE]);

//List Call Record
	RECT rtCallRecList[]=
	{
		118, 92, 655, 404,//ListWnd 
		50,  2, 300, 42,//Tel Label
		300,  2, 637, 42,//Time Comment
	};
	m_listCallRec.SetPos(rtCallRecList[0].left,rtCallRecList[0].top, 
		rtCallRecList[0].right - rtCallRecList[0].left, rtCallRecList[0].bottom - rtCallRecList[0].top);
	m_listCallRec.SetID(2104);
	m_listCallRec.EnableScrollBarV(true);
	m_listCallRec.EnableNotifyMessage(true);
	m_listCallRec.SetItemHeight(44);
	m_listCallRec.SetTextColor(RGB(255,255,255));
//	m_listPhoneBook.SetTextRect(&rtText);
	m_listCallRec.SetTextProperty(&rtCallRecList[1], &rtCallRecList[2], 28, 28);

	AddChild(&m_listCallRec);
}

BOOL UiCallRecWnd::InitImages()
{
	return TRUE;
}
void UiCallRecWnd::DeleteImages()
{
	m_CallRecWndBG->UnloadImage();
}